package com.youlu.campus.admin.user.controller;

import com.youlu.campus.entity.UserInfoExtend;
import com.youlu.campus.entity.english.vo.request.UserCompetitionFeeQuery;
import com.youlu.campus.service.qa.UserQaInfoService;
import com.youlu.campus.service.visitor.UserInfoExtendService;
import com.yuelin.infrastructure.quantum.common.QResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
public class UserInfoExtendController {

    @Autowired
    private UserInfoExtendService userInfoExtendService;

    @Autowired
    private UserQaInfoService userQaInfoService;

    @GetMapping("/userinfo/detail")
    public  QResult detail(@RequestParam String id){
        return QResult.success(userInfoExtendService.findById(id));
    }

    @PostMapping("/userinfo/ext/update")
    public QResult updateUserinfoExt(@RequestBody UserInfoExtend userInfoExtend){
        userInfoExtendService.updateUserInfoExt(userInfoExtend);
        return QResult.success(null);
    }


    /**
     * QQ 打卡小程序 报名用户
     * @param userQuery
     * @return
     */
    @PostMapping("/userinfo/ext/list")
    public  QResult userInfoExt(@RequestBody UserCompetitionFeeQuery userQuery){
      return QResult.success(userInfoExtendService.list(userQuery));
    }

    /**
     * QQ 打卡用户报名答题 邀请数量
     * @param userId
     * @return
     */
    @GetMapping("/userinfo/qa-invite/statistics")
    public  QResult userInfoInfo(@RequestParam String userId){
        return QResult.success(userQaInfoService.queryUserQaInviteStatisticsByUserId(userId));
    }

    /**
     * 初始化用户信息-从订单中
     * @return
     */
    @GetMapping("/public/userinfo/init")
    public QResult initUserInfoData(){
        return QResult.success(null);
    }



}
